fix(tooltip): tooltip not appearing in RunMode::Lazy#179
Closed
Tom94 wants to merge 2 commits intomitsuba-renderer:masterfrom
Closed
fix(tooltip): tooltip not appearing in RunMode::Lazy#179Tom94 wants to merge 2 commits intomitsuba-renderer:masterfrom
RunMode::Lazy#179Tom94 wants to merge 2 commits intomitsuba-renderer:masterfrom
Conversation
NanoGUI potentially spends a significant amount of runtime in the functions ``nvgTextBounds()`` and ``nvgTextBoxBounds()`` that are used to compute the preferred size of widgets. This commit adopts a strategy that caches the preferred size in bottom-level widgets (i.e., ones that don't layout a set of child widgets). The main complication is that various kinds of changes (setting different captions, themes, etc.) can invalidate the precomputed preferred size, so a relatively large number of setters need touchups. ;#
This commit adds a background thread that triggers a redraw 200ms after the last user interaction if the user was hovering a widget with tooltip at that point.
94dccba to
a40d87a
Compare
c75898b to
1bbd038
Compare
Member
|
Hi Thomas -- I ended up implementing this slightly differently (but I am open to feedback/changes). See 9e27364. The idea is to sleep on a condition variable until a deadline, and this deadline which can be further postponed without having to explicitly talk to the other thread (it will just wake up after 200msec and realize that it can wait even longer). I think that this will be cheaper (fewer CPU wakeups, less work for the OS scheduler) than polling with 1 msec period. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This commit adds a background thread that triggers a redraw
m_tooltip_delayseconds after the last user interaction if the user was hovering a widget with tooltip at that point.I settled on
void*type erasure to avoid including<thread>-- let me know if you'd rather I use another method.